var num=0;//记录输入参数的个数

var j,dt,dy;
tao =new array(0.1,0.2,0.3,0.4,0.5);//保存时间常数数组
//

//
 var temptmax = ta;
 var temptmin = ta;

ox=dota._x;
oy=dota._y;

function initialize() {	
_root.createEmptyMovieClip ("mymc", 2);//建立绘图对象
inputBTN1 = true;
   num=0;
   tao0="    ";
   tao1="    ";
   tao2="    ";
   tao3="    ";
   tao4="    ";
   tao5="    ";
   ta=0.1;
   temptmax = ta;
   temptmin = ta;
   t1 = temptmax;
   t2 = 2*temptmax;
   t3 = 3*temptmax;
   t4 = 4*temptmax;
   x4 = 1/temptmin;
   x3 = 0.75/temptmin;
   x2 = 0.5/temptmin;
   x1 = 0.25/temptmin;
   }

function getmax_xy(){
	temptmax=tao[0];
	temptmin=tao[0];
	for (jr=1;jr<num;jr=jr+1)
	   {  if (temptmax<tao[jr]){temptmax=tao[jr]};
		  if (temptmin>tao[jr]){temptmin=tao[jr]};
	   }
	dt=80/temptmax;
	dy=240*temptmin;
}

var xx1,xx2,yy1,yy2,t;
function drawLine(i) {
	//i=9;
	clr=new array(0xffff00,0xff00,0xffff,0xff00ff);
    var	t=0;
	with(_root.mymc) {
		linestyle(2, clr[i], 100);
		y = Math.exp(-t/tao[i])/tao[i];
	        moveTo(ox+dt*t,oy-dy*y);
		while (t<temptmax*5) {
			t = t+temptmax*0.025;
			y = Math.exp(-t/tao[i])/tao[i];
	        lineTo(ox+dt*t,oy-dy*y);}
			moveTo(575,190+i*30);
			lineTo(590,190+i*30);
		}
};



initialize();


BTNInput1.onRelease = function() {
	
	//inputEnd = drawInputFunction(inputEndCondition);
	//drawInputLine(num,100,100,300,300);
	if((inputBTN1 == true)&&(num<5)){tao0="T";
	if (ta !=""){ti=ta;
	    if (ti!=0)
		  {tao[num]=ti;
		  switch (num){
	          case 0: tao1=tao[num];break;
		      case 1: tao2=tao[num];break;
	          case 2: tao3=tao[num];break;
		      case 3: tao4=tao[num];break;
	          case 4: tao5=tao[num];break;
		      default: 
			}
		   num=num+1;
		   err1=""
		   
}
	else {err1="Error"}
		   	}
	else {err1="Error"}		}
	else {err1="请先按“清除”按钮"}
    
}

BTNInput2.onRelease = function() {
/*	temptmax=tao[0];
	temptmin=tao[0];
	for (j=1;j<num;j=j+1)
	   {  if (temptmax<tao[j]){temptmax=tao[j]};
		  if (temptmin>tao[j]){temptmin=tao[j]};
	   }*/
   if (num==0){err1="Error"}else{   
   getmax_xy();   
   t1 = temptmax;
   t2 = 2*temptmax;
   t3 = 3*temptmax;
   t4 = 4*temptmax;
   x4 = 1/temptmin;
   x3 = 0.75/temptmin;
   x2 = 0.5/temptmin;
   x1 = 0.25/temptmin;
	for (jk=0;jk<num;jk=jk+1){
	drawLine(jk);}
	inputBTN1 = false;}
}

BTNInput3.onRelease = function() {
	
	initialize();
	inputBTN1 = true;
	err1=""
}
